package custom;

public class CustomNumber {
    /**
     * @param number1
     * @param number2
     * @return 返回number1和number2的最大公约数
     */
    public static long greatestCommonDivisor(long number1, long number2) {
        if (number1 < number2)
            number2 = (number1 + number2) - (number1 = number2);
        long mod = number1 % number2;
        while (mod != 0) {
            number1 = number2;
            number2 = mod;
            mod = number1 % number2;
        }
        return number2;
    }
}
